#include "Iteration.h"

using namespace Eigen;

VectorXd relaxiteration(const SparseMatrix<double> &A, const VectorXd &b, const VectorXd &ini, int times, double omega)
{
    VectorXd res(ini);
    auto mleft = omega * A.diagonal().asDiagonal().inverse();
    for (int i = 0; i < times; i++)
        res = res + mleft * (b - A * res);
    return res;
}